package API.DAY11.reflect;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class ReflectDemo6 {
    public static void main(String[] args) throws Exception{
        Class cls = Class.forName("API.DAY10.reflect.Person");
        Method method = cls.getMethod("say",String.class);

        String name = method.getName();
        System.out.println("名字:"+name);

        Class returnType = method.getReturnType();
        System.out.println("返回类型:"+returnType);

        int count = method.getParameterCount();
        System.out.println("参数个数:"+count);

        int modifieres = method.getModifiers();
        switch (modifieres){
            case Modifier.PUBLIC:
                System.out.println("public");
                break;
            case Modifier.PRIVATE:
                System.out.println("private");
                break;
            case Modifier.PROTECTED:
                System.out.println("protected");
                break;
            default:
                System.out.println("default");
        }
    }
}
